<template>
    <div class="bidding-show-box">
        <v-dialog
            title="查看"
            :show.sync="dialogVisible"
            width="1200px"
            @beforeClose="beforeClose"
            :close-on-click-modal="false">
            <div class="card-box">
                <div class="card-title">工程信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="工程名称" prop="projectName">
                        <span class="int-text">{{showForm.projectName}}</span>
                    </el-form-item>
                    <el-form-item label="工程地址" prop="projectAddress">
                        <span class="int-text">{{showForm.projectAddress}}</span>
                    </el-form-item>
                    <el-form-item label="工程类型" prop="projectType">
                        <span class="int-text">{{getCardTypeValue(showForm.projectType,projectTypes)}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">设计招标信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="中标文号" prop="designDocument">
                        <span class="int-text">{{showForm.designDocument}}</span>
                    </el-form-item>
                    <el-form-item label="中标单位" prop="designUnit">
                        <span class="int-text">{{showForm.designUnit}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="designAmount">
                        <span class="int-text">{{showForm.designAmount}}</span>
                    </el-form-item>
                    <el-form-item label="中标日期" prop="designDate">
                        <span class="int-text">{{showForm.designDate}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">监理招标信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="中标文号" prop="supervisorDocument">
                        <span class="int-text">{{showForm.supervisorDocument}}</span>
                    </el-form-item>
                    <el-form-item label="中标单位" prop="supervisorUnit">
                        <span class="int-text">{{showForm.supervisorUnit}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="supervisorAmount">
                        <span class="int-text">{{showForm.supervisorAmount}}</span>
                    </el-form-item>
                    <el-form-item label="中标日期" prop="supervisorDate">
                        <span class="int-text">{{showForm.supervisorDate}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">造价咨询信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="中标文号" prop="costDocument">
                        <span class="int-text">{{showForm.costDocument}}</span>
                    </el-form-item>
                    <el-form-item label="中标单位" prop="costUnit">
                        <span class="int-text">{{showForm.costUnit}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="costAmount">
                        <span class="int-text">{{showForm.costAmount}}</span>
                    </el-form-item>
                    <el-form-item label="中标日期" prop="costDate">
                        <span class="int-text">{{showForm.costDate}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">招标代理信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="中标文号" prop="agentDocument">
                        <span class="int-text">{{showForm.agentDocument}}</span>
                    </el-form-item>
                    <el-form-item label="中标单位" prop="agentUnit">
                        <span class="int-text">{{showForm.agentUnit}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="agentAmount">
                        <span class="int-text">{{showForm.agentAmount}}</span>
                    </el-form-item>
                    <el-form-item label="中标日期" prop="agentDate">
                        <span class="int-text">{{showForm.agentDate}}</span>
                    </el-form-item>
                </el-form>
                <div class="card-title">施工招标信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="中标文号" prop="constructionDocument">
                        <span class="int-text">{{showForm.constructionDocument}}</span>
                    </el-form-item>
                    <el-form-item label="中标单位" prop="constructionUnit">
                        <span class="int-text">{{showForm.constructionUnit}}</span>
                    </el-form-item>
                    <el-form-item label="金额(元)" prop="constructionAmount">
                        <span class="int-text">{{showForm.constructionAmount}}</span>
                    </el-form-item>
                    <el-form-item label="中标日期" prop="constructionDate">
                        <span class="int-text">{{showForm.constructionDate}}</span>
                    </el-form-item>
                </el-form>
              <!--  <div class="card-title">创建信息</div>
                <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
                    <el-form-item label="创建人" prop="createName">
                        <span class="int-text">{{showForm.createName}}</span>
                    </el-form-item>
                    <el-form-item label="创建时间" prop="createTime">
                        <span class="int-text">{{showForm.createTime}}</span>
                    </el-form-item>
                </el-form>-->
                <div class="card-title">附件</div>
                <div class="handling-opinions">
                    <v-upload
                        ref="tenderInfoUpload"
                        :busId="showForm.projectTenderId"
                        modelType="tenderInfo"
                        isShowFileList
                        :isView="true"
                        multiple
                        v-model="fileList"/>
                </div>
            </div>
            <div class="card-box"><el-button class="btn" type="primary" size="small" @click="shutDown()">关闭</el-button></div>
        </v-dialog>
    </div>
</template>

<script>
    import {get} from '../api/tenderInfo'

    export default {
        name: "show-actual",
        mounted() {
            this.projectTypes = this.getDict("epc_project_type")
        },
        data() {
            return {
                dialogVisible: false,
                fileList: [],
                projectTypes: [],
                showForm: {
                    projectId: '',
                    projectSetupId: '',
                    projectTenderId: '',
                    projectName: '',
                    projectAddress: '',
                    projectType: '',
                    designDocument: '',
                    designUnit: '',
                    designAmount: '',
                    designDate: '',
                    supervisorDocument: '',
                    supervisorUnit: '',
                    supervisorAmount: '',
                    supervisorDate: '',
                    costDocument: '',
                    costUnit: '',
                    costAmount: '',
                    costDate: '',
                    agentDocument: '',
                    agentUnit: '',
                    agentAmount: '',
                    agentDate: '',
                    constructionDocument: '',
                    constructionUnit: '',
                    constructionAmount: '',
                    constructionDate: ''
                }
            }
        },
        methods: {
            //打开弹框
            show(item){
                this.dialogVisible=true
                if(item){
                    this.showForm.projectTenderId = item
                    get(item).then(res=>{
                        if (res.data.code === 0 && res.data.data.epcProjectTender !== null) {
                            this.showForm = res.data.data.epcProjectTender
                        } else {
                            this.$message.warning('暂未获取到数据！')
                        }
                    })
                }
            },
            //关闭弹框
            beforeClose(done) {
                this.$emit('beforeClose')
            },
            shutDown(){
                this.$emit('handleClose')
                this.dialogVisible = false
            },
            //对应value取label
            getCardTypeValue(num, sum){
                let arr = sum.filter(e=>e.value === num)
                if (arr.length > 0) {
                    return arr[0].label
                } else {
                    return num
                }
            }
        }
    }
</script>

<style scoped lang="scss">
    @include formWrap(4);
    .card-box {
        position: relative;
        min-height: 55px;
        .handling-opinions {
            padding: 20px;
        }
        .btn {
            position: absolute;
            top: 10px;
            right: 15px;
        }
        .int-text {
            color: #999;
        }
    }
</style>
